<template>
  <div class="body">
    <div class="banner">
      <img :src="bannersrc">
      <div class="dream"><span>{{text1}}</span>{{text2}}</div>
      <div class="etext">{{text3}}</div>
      <div class="ctext">{{text4}}</div>
      <div class="name">{{name}}</div>
    </div>
    <div class="section">
      <div>
        <router-link tag="div" to="/common/courseNav?title=精品课程">
          <img :src="sec1src">
          <div class="sec-text">精品课程</div>
        </router-link>

      </div>
      <div>
        <router-link tag="div" to="/common/hot-course">
          <img :src="sec2src">
          <div class="sec-text">热门说课</div>
        </router-link>
      </div>
      <div>
        <router-link tag="div" to="/common/movie?title=影视精品">
          <img :src="sec3src">
          <div class="sec-text">影视精品</div>
        </router-link>
      </div>
    </div>
    <div class="book">
      <div class="bookimg">
        <img :src="bookObject.booksrc">
      </div>
      <div class="booktext">
        <div>{{bookObject.content}}</div>
        <router-link :to="{path:'/common/subDetail',query:{bookId:bookObject.bookId,title:bookObject.bookName}}"><div class="button">Let's Go ></div></router-link>
      </div>
    </div>
  </div>
</template>
<script>
    export default {
      name:'index',
      data: function(){
        return {
          "bannersrc":"",
          "text1":"",
          "text2":"",
          "text3":"",
          "text4":"",
          "name":"",
          "sec1src":"",
          "sec2src":"",
          "sec3src":"",
          "bookObject":""
        }
      },
      mounted:function(){
        this.$http.get("static/index.json").then(function(res){
          this.bannersrc=res.data.bannersrc;
          this.text1=res.data.text1;
          this.text2=res.data.text2;
          this.text3=res.data.text3;
          this.text4=res.data.text4;
          this.name=res.data.name;
          this.sec1src=res.data.sec1src;
          this.sec2src=res.data.sec2src;
          this.sec3src=res.data.sec3src;
          this.bookObject=res.data.bookObject;
        },function(res){console.log(res);})
      }
    }
</script>
<style scoped>
  .banner{
    width: 100%;
    /*height: 730px;*/
    background-color: #FBFBFD;
    position: relative;
  }
  .banner img{
    width: 90%;
    margin-top: 5%;
  }
  .dream{
    position: absolute;
    left: 8%;
    bottom: 30%;
    color: white;
    font-size: 26px;
  }
  .dream span{
    font-size: 24px;
  }
  .etext{
    position: absolute;
    left: 8%;
    bottom: 17%;
    color: white;
    width: 75%;
    font-size: 12px;
    text-align: left;
  }
  .ctext{
    position: absolute;
    left: 8%;
    bottom: 10%;
    color: black;
    width: 80%;
    font-size: 10px;
    text-align: left;
  }
  .name{
    position: absolute;
    bottom: 4%;
    right: 8%;
    font-size: 14px;
    color: white;
  }
  .section{
    margin-top: 20px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-around;
  }
  .section img{
    width:70%;
    display: inline-block;
  }
  .section .sec-text{
    font-size: 14px;
    margin-top: 10px;
    /*font-weight: bold;*/
  }
  .book{
    /*margin-top: 50px;*/
    display: flex;
    padding: 1% 5%;
    align-items: center;
    height: 120px;
  }
  .bookimg{
    width: 46%;
  }
  .bookimg img{
    width: 100%;
    /*height: 420px;*/
  }
  .booktext{
    width: 52%;
    color: #8E8E90;
    font-size: 12px;
    text-indent:1em;
    padding:0 2% 2% 4%;
    text-align: left;
    height:85%;
  }
  .button{
    width: 55%;
    height: 20px;
    background-color: #F8805D;
    color: white;
    border-radius: 10px;
    text-align: center;
    line-height: 20px;
    margin-top: 10px;
    margin-left: 24%;
    text-indent: 0;
    font-size: 10px;
    border: none;
  }
  @media (max-width: 320px){
    .etext{
      display: none;
    }
    .ctext{
      bottom: 12%;
    }
    .name{
      bottom: 6%;
    }
  }
</style>
